
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head lang="en">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>管理员界面</title>

<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/landing-page.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<!-- text fonts -->
<link rel="stylesheet" href="fonts/fonts.googleapis.com.css" />
<!-- ace styles -->
<link rel="stylesheet" href="css/ace.min.css" />

<!--[if lte IE 9]>
<link rel="stylesheet" href="css/ace-part2.min.css" />
<![endif]-->
<link rel="stylesheet" href="css/ace-rtl.min.css" />
<!--[if lte IE 9]>
<link rel="stylesheet" href="css/ace-ie.min.css" />
<![endif]-->

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="js/jquery.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/bootstrap.js"></script>
    

    
    
</head>
<body>
<style>
#myButton{
	border:1px solid #FFF;
	font-family: '微软雅黑';
}
</style>

<!-- 4. 鼠标悬停效果表格-->
<div class="intro-header" style="padding-bottom: 400px;">
    <table  class="table  table-bordered  table-condensed"  id="userInformation" >
        <!--用户信息表头-->
        <caption style="text-align: center;font-size: 200%;font-family:'微软雅黑';color:#ffffff;"><b>The User Information<hr class="intro-divider"></b></caption>
        
        <thead>
        <tr>
            <th>用户名</th>
            <th>邮箱</th>
            <th>电话号码</th>
            <th>登陆时间</th>
            <th>权限</th>
        </tr>
        </thead>
        <!--构建表身部分-->
        <tbody>
        <!--从数据库中返回整个用户信息表单-->
        <?php
        session_start();//启用回话窗
        // 创建连接
        $conn = new mysqli("localhost", "root","wei1995629", "information");
        // 检测连接
        if ($conn->connect_error) {
            die("连接失败: " . $conn->connect_error);
        }
        $sql = "SELECT * FROM userInformation WHERE userName='{$_SESSION['note']}'";
        $result = mysqli_query($conn,$sql);
        
        if ($result->num_rows > 0) {
            // 输出每行数据
            while($row = $result->fetch_assoc()) {
                echo 
                "<tr> "
                ."<td>" .$row["userName"] ."</td>"
                ."<td>" .$row["email"] ."</td>"
                ."<td>" .$row["telNumber"] ."</td>"
                ."<td>" .$row["reg_date"] ."</td>";
                if("ADMIN" == $row["admin"]){
                    echo "<td>" ."<button class='btn btn-default'  type='button' id='myButton'>已拥有权限</button>" ."</td>";
                }
                else{
                    echo "<td>" ."<button class='btn btn-default'  type='button' id='myButton' value='" .$row['userName'] ."' >设置为管理</button>" ."</td>";
                }
    
                echo"</tr>";
                }
        } 
        else {
            echo "No More.";
        }
        $conn->close();//关闭数据库
        ?>
        
        </tbody>
    </table>
</div>

</body>
</html>
